package com.bianmaba.oauth2.bean.entity;

import com.bianmaba.spring.supports.data.beans.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "[Order]")
public class Order extends BaseEntity {
    private String name;
    private String description;
    @OneToMany()
    @JoinTable(name = "Order_ref_Commodity", joinColumns = @JoinColumn(name = "order_id"), inverseJoinColumns = @JoinColumn(name = "commodity_id"))
    private List<Commodity> commodities = new ArrayList<Commodity>(0);

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public List<Commodity> getCommodities() {
        return commodities;
    }

    public void setCommodities(List<Commodity> commodities) {
        this.commodities = commodities;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}
